#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
struct Complex {
    int real;
    int image;
};

void input(Complex &c) {
    cin >> c.real >> c.image;
}

void output(Complex c) {
    if (c.image > 0)
        printf("%d+%di\n", c.real, c.image);
    else if (c.image < 0)
        printf("%d-%di\n", c.real, -c.image);
    else
        printf("%d\n", c.real);
}

Complex add(Complex a, Complex b) {
    Complex c = {0, 0};
    c.real = a.real + b.real;
    c.image = a.image + b.image;
    return c;
}

Complex mul(Complex a, Complex b) {
    Complex c = {0, 0};
    c.real = a.real * b.real - a.image * b.image;
    c.image = a.real * b.image + a.image * b.real;
    return c;
}

int main() {
    Complex c, sum = {0, 0};
    int T;
    cin >> T;
    while (T--) {
        input(c);
        sum = add(sum, c);
    }
    output(sum);
    return 0;
}